]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Dispose Source on destruction
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 14 May 2019 02:03:51 +0000 (04:03 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 16 Oct 2019 15:26:13 +0000 (15:26 +0000)
Dispose the Source Object when dispose() is called, avoiding that it could be
called twice on a destroyed Source.

So, notify count changes before destroying the object, and don't emit this
twice on destroyNonResidentNotifications (as if a notification is destroyed
the property notify will happen in the notification destroy callback anyways).

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/559

js/ui/messageTray.js

index fda7f5bec69d486b76c17d27c1af8d3e17f7d0d2..0d8e884c606ec7fa5cea6a3fc61b3cdcc57ee20d 100644 (file)
@@ -834,10 +834,10 @@ var Source = GObject.registerClass({
             return;
 
         this.notifications.splice(index, 1);
+        this.countUpdated();
+
         if (this.notifications.length == 0)
             this.destroy();
-
-        this.countUpdated();
     }
 
     pushNotification(notification) {
@@ -891,6 +891,8 @@ var Source = GObject.registerClass({
             notifications[i].destroy(reason);
 
         this.emit('destroy', reason);
+
+        this.run_dispose();
     }
 
     iconUpdated() {
@@ -905,8 +907,6 @@ var Source = GObject.registerClass({
         for (let i = this.notifications.length - 1; i >= 0; i--)
             if (!this.notifications[i].resident)
                 this.notifications[i].destroy();
-
-        this.countUpdated();
     }
 });